using System.Collections;
using System.Collections.Generic;
using Framework.Utils.UITools;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;

public static class CustomComponent
{
    [MenuItem("GameObject/Atou Custom/Button(Transparent) ", false, 10)]
    private static void CreateCustomButton(MenuCommand menuCommand)
    {
        // 创建一个新的 GameObject
        GameObject go = new GameObject("TransparentButton");

        // 确保它有 RectTransform 组件
        RectTransform rectTransform = go.AddComponent<RectTransform>();

        // 添加自定义按钮脚本
        go.AddComponent<Button>();
        // 添加自定义脚本
        go.AddComponent<RaycastMask>();

        // 确保新的 GameObject 位于当前选择的对象下
        GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);

        // 注册撤销操作
        Undo.RegisterCreatedObjectUndo(go, "Create CustomButton");

        // 选中新的 GameObject
        Selection.activeObject = go;
    }
}
